//-----------------------------------------------------------------------------
//  File          : constant.h
//  Module        :
//  Description   : Declrartion & Defination for constant.c
//  Author        : Lewis
//  Notes         :
//
// ============================================================================
// | Naming conventions                                                       |
// | ~~~~~~~~~~~~~~~~~~                                                       |
// |        Struct define : Leading T                                         |
// |         Struct/Array : Leading s                                         |
// |             Constant : Leading K                                         |
// |      Global Variable : Leading g  (variable use outside one C file)      |
// |                                                                          |
// |   BYTE( 8 Bits) size : Leading b                                         |
// |   CHAR( 8 Bits) size : Leading c                                         |
// |   WORD(16 Bits) size : Leading w                                         |
// |  DWORD(32 Bits) size : Leading d                                         |
// |    int(32 Bits) size : Leading i                                         |
// | DDWORD(64 Bits) size : Leading dd                                        |
// |              Pointer : Leading p                                         |
// |                                                                          |
// |    Function argument : Leading a                                         |
// |       Local Variable : All lower case                                    |
// |                                                                          |
// | Examples:                                                                |
// |                Array : Leading s, (sb = arrary of byte, etc)             |
// |              Pointer : Leading p, (pb = pointer of byte, etc)            |
// ============================================================================
//
//  Date          Who         Action
//  ------------  ----------- -------------------------------------------------
//  29 Sept 2008  Lewis       Initial Version.
//-----------------------------------------------------------------------------
#ifndef _CONSTANT_H_
#define _CONSTANT_H_
#include "common.h"

//-----------------------------------------------------------------------------
//    Defines
//-----------------------------------------------------------------------------

/*-----  BATCH RECORD TRANS STATUS BIT ----------------------*/
#define VOIDED          0x80
#define ADJUSTED        0x40
#define UPLOADED        0x20
#define OFFLSUCC        0x10
#define OFFLFAIL        0x08
#define ADJ_SALE        0x04
#define ADJ_OFFL        0x02
#define EMV_TRANS       0x01  //emv+

/*-----  TRANSACTION TYPES  ---------------------------------*/
enum {
	SALE                    ,
	BALANCE		       				,
	BIRD_CHARGE							,
	BIRD_PAYMENT						,
	PHENIX_OLDER						,
	PHENIX_OLDER_REV				,
	PHENIX_BALANCE					,
	PHENIX_NEWMENU					,
	PHENIX_NEWPRICE					,
	PHENIX_VOID							,
	PHENIX_VOID_BALANCE			,
	SALE_REV						    ,
	PHENIX_REFUND						,
	BIRD_REFUND             ,
	LOGON                   ,
	BIRD_LOGOFF							,
	SETTLEMENT              ,
	SALE_VOID               ,
	SALE_VOID_REV           ,
	BLACK_CHECK             ,
	TRANS_UPLOAD            ,
	DISP_VER                ,

  MAX_TXN_TYPE            ,
  DEFAULT_TRANS = 255     ,
};

struct TRANS_BITMAP {
  WORD w_txmsg_id;
  BYTE sb_txbitmap[8];
  BYTE b_proc_code[3];
  BYTE b_condition_code;
  BYTE b_type;
  BYTE b_sale_flag;  /* 0 not sale, 1 credit card sale, 2 debit sale, 3 redeem */
  BYTE b_status;
};

extern const struct TRANS_BITMAP KTransBitmap[MAX_TXN_TYPE];
extern const BYTE KSetlPCode2[3];
extern const BYTE KTransHeader[];

//-----------------------------------------------------------------------------
//      Functions Handle the data
//-----------------------------------------------------------------------------
extern BOOLEAN SaleType(BYTE aTrans);

#endif // _CONSTANT_H_

